<h1>Liste des questions</h1>

<table>
  <tr>
    <th>Admin</th>
    <th>Question</th>
    <th>Date affichage</th>
    <th>Nb Oui</th>
    <th>Nb Non</th>
    <th colspan="2">Actions</th>
  </tr>

<% @questions.each do |question| %>
  <tr>
    <td><%= link_to question.admin.pseudo, question.admin %></td>
    <td><%= question.sujet %></td>
    <td><%= question.dateAffichage.strftime("%d/%m/%Y")  %></td>
    <td><%= question.oui %></td>
    <td><%= question.non %></td>
    <% if current_user == question.admin.user %>
        <td><%= link_to 'Editer', edit_question_path(question) %></td>
        <td><%= link_to 'Supprimer', question, :confirm => 'Are you sure?', :method => :delete %></td>
    <% end %>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'Nouvelle question', new_question_path %>